<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function changePos() {
				let h = document.getElementById("t");
				if (h.align == "right")
					h.align = "left";
				else
					h.align = "right";
			}

			function changePass() {
				document.getElementsByName("qq")[0].type = "text";
			}

			function changeLink() {
				let g = document.getElementById("g");
				g.href = "http://www.itpub.net";
				g.target = "_blank";
				//g.innerHTML="itpub社区";
				//g.innerHTML='<img src="../img/fink.png"/>';
				g.innerHTML = "<img src='../img/fink.png' height='60px' width='100px'/>";
				//g.innerText="<img src='../img/fink.png' height='60px' width='100px'/>";
			}

			function changeDiv() {
				let d = document.getElementById("adv");
				//alert(d.innerHTML);
				// d.innerHTML="";//追加一个链接，链接到oschina

				d.innerHTML += '<a href="https://www.oschina.net" id="g">中国开源</a>'
			}

			function clearBody(){
				window.document.body.innerHTML="";
			}
		</script>
	</head>
	<body>
		<h1 id="t">普大喜奔，赵俊杰9点起床</h1>
		<input type="password" name="qq" placeholder="QQ密码" />
		<div id="adv">
			<a href="https://www.baidu.com" id="g">百度</a>
		</div>
		<div>
			<button type="button" onclick="changePos()">换文字位置</button>
			<button type="button" onclick="changePass()">查看密码</button>
			<button type="button" onclick="changeLink()">修改链接</button>
			<button type="button" onclick="changeDiv()">修改div</button>
			<button type="button" onclick="clearBody()">清空body</button>
		</div>
	</body>
</html>
